package com.socket.TCP.client;

import java.io.*;
import java.net.Socket;

/**
 * Created by wangyg on 2016/10/31.
 */
public class Client {
	public static void main(String[] args) throws IOException {
		Socket socket= new Socket("localHost",9999);
		OutputStream outputStream = socket.getOutputStream();
		PrintWriter pw = new PrintWriter(outputStream);
		pw.write("用户名：09876；密码：8765");
		pw.flush();
		socket.shutdownOutput();

		InputStream is = socket.getInputStream();
		InputStreamReader isr= new InputStreamReader(is);
		BufferedReader br = new BufferedReader(isr);
		String read=null;
		while((read=br.readLine())!=null){
			System.out.println(read);
		}
		pw.close();
		outputStream.close();



//		socket.shutdownInput();
		br.close();
		isr.close();
		is.close();



		socket.close();

	}
}
